<template>
  <div id="digital-flop">
    <div
      class="digital-flop-item"
      v-for="(item,index) in phoneProduct"
      :key="item.product_id"
    >
      <div class="digital-flop-title">{{ item.product_name }}</div>
      <div class="digital-flop">
        <dv-digital-flop
          :config="{
            number: [item.product_selling_price],
            content: '{nt}',
            textAlign: 'right',
            style: {
              fill: DigitalColor[index],
              fontWeight: 'bold'
            }
          }"
          style="width:100px;height:50px;"
        />
          <div class="unit">元</div>
      </div>
    </div>

    <dv-decoration-10 />
  </div>
</template>

<script>
import { getCarouselList, getPromoProduct } from '@/api/index'
import axios from 'axios'

export default {
  name: 'DigitalFlop',
  data () {
    return {
      digitalFlopData: [],
      phoneProduct: [], // 手机数据
      DigitalColor: ['#5d9af5', '#e4703b', '#7df7ed','#5d9af5', '#e4703b', '#7df7ed','#5d9af5', '#e4703b', '#7df7ed']
    }
  },
  methods: {
    createData () {

      getCarouselList().then(res=>{
        console.log('res', res);
      })


      getPromoProduct({
        categoryName: "手机"
      }).then(res=>{
        console.log('手机', res);
        this.phoneProduct = res.Product
      })

      getPromoProduct({
        categoryName: "电视机"
      }).then(res=>{
        console.log('电视机', res);
      })

    },
    randomExtend (minNum, maxNum) {
      if (arguments.length === 1) {
        return parseInt(Math.random() * minNum + 1, 10)
      } else {
        return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10)
      }
    }
  },
  created () {
    this.createData()
  }
}
</script>

<style lang="less">
#digital-flop {
  position: relative;
  height: 15%;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(6, 30, 93, 0.5);

  .dv-decoration-10 {
    position: absolute;
    width: 95%;
    left: 2.5%;
    height: 5px;
    bottom: 0px;
  }

  .digital-flop-item {
    width: 11%;
    height: 80%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-left: 3px solid rgb(6, 30, 93);
    border-right: 3px solid rgb(6, 30, 93);
  }

  .digital-flop-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .digital-flop {
    display: flex;
  }

  .unit {
    margin-left: 10px;
    display: flex;
    align-items: flex-end;
    box-sizing: border-box;
    padding-bottom: 13px;
  }
}
</style>
